home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
program
/
swagn_r.zip
/
RECORDS.SWG
/
0010_Another Delete Routine.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-08-27
|
842b
|
34 lines
{
STEVE ROGERS
>A method that I have successfully used to delete Records in place is to...
'Scuse me For butting in, but I have another approach which will
preserve your Record order. I will present it For a File of Records
the total size of which is less than 64K. The routine may easily be
adapted For large Files:
}
Procedure del_rec(fname : String; target : LongInt; rec_size : LongInt);
Type
t_buf = Array[1..65520] of Byte;
Var
f : File;
buf : ^t_buf;
n : Word;
begin
new(buf);
assign(f, fname); { open your File }
reset(f, 1);
blockread(f, buf^, sizeof(buf^), n);
close(f);
move(buf^[succ(target) * rec_size],
buf^[target * rec_size], n - (target * rec_size));
dec(n, rec_size);
reWrite(f, 1);
blockWrite(f, buf^, n);
close(f);
dispose(buf);
end;